import threading
from time import ctime, sleep


loops = [4, 2]


def loop(nloop, nsec):
    print(f'start loop {nloop} at {ctime()}')
    sleep(nsec)
    print(f'{nloop} done at {ctime()}')


def main():
    print(f'starting at: {ctime()}')
    threads = []

    for i in range(len(loops)):
        t = threading.Thread(target=loop, args=(i, loops[i]))
        threads.append(t)

    for i in range(len(loops)):
        threads[i].start()

    for i in range(len(loops)):
        threads[i].join()

    print(f'all done at {ctime()}')


if __name__ == '__main__':
    main()